package com.comac.tasks.manager.app.config;

import com.comac.tasks.manager.app.filter.FeignAuthFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description
 * @Author lihao
 * @Date 2022/1/14 19:16
 */
@Configuration
public class WebMvcFilterConfig {

    @Bean
    public FilterRegistrationBean feignAuthFilterBean() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(feignAuthFilter());
        registration.addUrlPatterns("/*");
        registration.setName("feignAuthFilter");
        registration.setOrder(1);
        return registration;
    }

    @Bean
    public FeignAuthFilter feignAuthFilter() {
        return new FeignAuthFilter();
    }
}
